<template>
  <div>
    <a-table
      ref="table"
      size="middle"
      :scroll="{ x: true }"
      rowKey="id"
      :columns="columns"
      :dataSource="dataSource"
      :pagination="ipagination"
      :loading="loading"
      class="j-table-force-nowrap"
      @change="handleTableChange"
    >
      <span slot="contentSlot" slot-scope="text">
        <a-tooltip>
          <template slot="title"> {{ text }}</template>
          <div class="content">
            {{ text }}
          </div>
        </a-tooltip>
      </span>
    </a-table>
  </div>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
export default {
  mixins: [JeecgListMixin, mixinDevice],
  props:{
    id:{
      type:String
    }
  },
  data() {
    return {
      disableMixinCreated: false,
       /* 分页参数 */
       ipagination:{
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '30','50','100'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '操作人',
          align: 'center',
          dataIndex: 'user',
        },
        {
          title: '操作时间',
          align: 'center',
          dataIndex: 'operateTime',
        },
        {
          title: '操作类型',
          align: 'center',
          dataIndex: 'operateType_dictText',
        },
        {
          title: '操作内容',
          align: 'center',
          dataIndex: 'content',
          width: 500,
          scopedSlots: { customRender: 'contentSlot' },
        },
      ],
      url: {
        list: '/sys/common/operateLog/list',
      },
    }
  },
  methods:{
    showLoad(id){
      this.queryParam.relateId = id
      this.loadData(1)
    },
  },
}
</script>
<style lang="less" scoped>
.content {
  width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-all;
  white-space: nowrap;
}
</style>